-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add Plotly custom mimetype to NB outputs. #713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
'text/html': script_inject, | ||
'text/vnd.plotly.v1+html': script_inject | ||
} | ||
ipython_display.display(display_bundle, raw=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why raw=True
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kully :
From IPython Docs:
raw : bool
Are the data objects raw data or Python objects that need to be formatted before display? [default: False]
We dont want IPython to do any further processing on this, so we use raw=True
.
@tarzzz Okay Tarun, it's clearer now how this is supposed to work based on the code. Just have that one comment but the rest looks fine to me. |
@Kully : We will also need to release a new version for this change, so that the users can do a pip upgrade and be able to use it with |
@cldougl : Updated Changelog and version .. 👍 |
lgtm 💃 after tests pass |
Great, merging!! 🎉 |
Azure notebooks sanitize HTML when the user requests to 'Download as HTML'. This leads to Plotly Charts being rendered in plain text. To tackle the same, we send the Plotly chart data as a custom mimetype:
text/vnd.plotly.v1+html
.PlotlyHTMLExporter (Plotly friendly, Jupyter Notebook HTML Exporter) recognizes this
mimetype, and renders the charts in their interactive version when notebook is converted to HTML.
PlotlyHTMLExporter
sanitizes all html content but leaves Plotly Charts intact.